# coding=utf-8
import json

# 返回值包装
class Result(object):

    def __init__(self, code, result):
        self.code = code
        self.result = result

    def to_json(self):
        temp = {"code": self.code, "result": self.result}
        return json.dumps(temp)


class SuccessResult(Result):
    def __init__(self, result):
        super(SuccessResult, self).__init__(200, result)


class ErrorResult(Result):
    def __init__(self, result):
        super(ErrorResult, self).__init__(500, result)
